<?php

function checkmobile() {
    $mobile = array();
    static $mobilebrowser_list = array('iphone', 'android', 'phone', 'mobile', 'wap', 'netfront', 'java', 'opera mobi', 'opera mini',
        'ucweb', 'windows ce', 'symbian', 'series', 'webos', 'sony', 'blackberry', 'dopod', 'nokia', 'samsung',
        'palmsource', 'xda', 'pieplus', 'meizu', 'midp', 'cldc', 'motorola', 'foma', 'docomo', 'up.browser',
        'up.link', 'blazer', 'helio', 'hosin', 'huawei', 'novarra', 'coolpad', 'webos', 'techfaith', 'palmsource',
        'alcatel', 'amoi', 'ktouch', 'nexian', 'ericsson', 'philips', 'sagem', 'wellcom', 'bunjalloo', 'maui', 'smartphone',
        'iemobile', 'spice', 'bird', 'zte-', 'longcos', 'pantech', 'gionee', 'portalmmm', 'jig browser', 'hiptop',
        'benq', 'haier', '^lct', '320x320', '240x320', '176x220');
    $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);

    $v = dstrpos($useragent, $mobilebrowser_list, true);
    //note 获取手机浏览器
    if (($v = dstrpos($useragent, $mobilebrowser_list, true))) {
        $client = $v;
        return $client;
    } else {
        return 'unknown';
    }
//    $brower = array('mozilla', 'chrome', 'safari', 'opera', 'm3gate', 'winwap', 'openwave', 'myop');
//    if (dstrpos($useragent, $brower))
//        return false;
//    $client = 'unknown';
//    if ($client === 'yes') {
//        return $useragent;
//    } else {
//        return $useragent;
//    }
//    return $v;
}

function dstrpos($string, &$arr, $returnvalue = false) {
    if (empty($string))
        return false;
    foreach ((array) $arr as $v) {
        if (strpos($string, $v) !== false) {
            $return = $returnvalue ? $v : true;
            return $return;
        }
    }
    return false;
}
?>
<style>
    body,html{padding:0px;margin:0px;font-family: "微软雅黑";background:#fff;}
    .m_logoimg{width:190px;height:62px;margin:150px auto 0px auto;}
    .m_footer{height:30px;line-height:30px;padding-left:10px;color:#aaa;font-size:14px;background:#000;}
    .m_open{width:158px;height:133px;position: absolute;top:10px;right:10px;background: url(./images/mobile/back.png) no-repeat top center;}
    .m_bodycontent{border:1px solid #fff;position: relative;text-align: center;}
    .downbtn{border:1px solid #0059a3;background: #00a7ea;padding: 10px;color:#fff;}
</style>
<script>
    $(document).ready(function() {
        var Wheight = $(window).height();
        var Wwidth= $(window).width();
//        alert(Wheight);
        $('.m_bodycontent').height(Wheight - 30);
    });
</script>
<div class="m_bodycontent">
    <div class="m_logoimg"><img src="http://www.ldfood.cn/images/logo2.png"/></div>
    <div class="m_open"></div>
    <?php
    $mobtype = checkmobile();
    if ($mobtype == 'iphone'):
        ?>
    <br/><br/><br/>
    <a href="" class="downbtn">下载Iphone客户端</a>
        <?php
    elseif ($mobtype == 'android'):
        ?>
    <br/><br/><br/>
        <a href="http://www.ldfood.cn:8080/downloading/android/download?type=1" class="downbtn">下载Android客户端</a>
        <?php
    else:
        ?>
        <br/><br/><br/>
        抱歉，没有适合的客户端版本
    <?php
    endif;
    ?>
</div>
<div class="m_footer">
    CopyRight &copy;2010-2014, 灵动生活
</div>
